package com.spzx.product.controller;

import com.spzx.common.core.web.controller.BaseController;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.product.domain.Category;
import com.spzx.product.service.CategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("category")
@Tag(name = "分类管理模块")
public class CategoryController extends BaseController {
    @Resource
    CategoryService categoryService;
    @Operation(summary = "根据分类id查询下一级分类")
    @GetMapping("listByPid/{pid}")
    public AjaxResult listByPid(@PathVariable Long pid){
        List<Category> categoryList = categoryService.listByPid(pid);
        return success(categoryList);
    }
}
